package com.lagou.ex.springboot.mybatisplus.base.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString
@TableName("user")
public class UserModel {
    /**
     * 是否删除：1删除 0存在
     */
    public static final String STATUS_YES = "1";
    public static final String STATUS_NO = "0";
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;
    private String portrait;
    private String phone;
    private String password;
    private String regIp;
    private Integer accountNonExpired;
    private Integer credentialsNonExpired;
    private Integer accountNonLocked;
    private String status;
    private Integer isDel;
    @JsonFormat(pattern = "yyyy-MM-dd") // controller返回时回用这个序列化，有默认格式
    @TableField(fill = FieldFill.INSERT) // 新增的时候填充数据
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE) // 新增或修改的时候填充数据
    private LocalDateTime updateTime;

}
